//
//  RoundedImage.m
//  CustomView
//
//  Created by hoho on 14-11-14.
//  Copyright (c) 2014年 thinkcart.net. All rights reserved.
//

#import "RoundedImageView.h"

@implementation RoundedImageView

- (void)setNeedsDisplay {
    [super setNeedsDisplay];
    self.clipsToBounds = YES;
    //无法在storyboard里即时预览，但运行是正确的
    self.layer.cornerRadius = self.frame.size.height / 2;
}

/*
 如果调转屏幕会改变图像的大小，那么可能在这里也要搞一下
- (void)setBounds:(CGRect)bounds {
    [super setBounds:bounds];
    self.layer.cornerRadius = self.frame.size.height / 2;
}
 */

/*
 对于UIImageView，这个函数不调用
- (void)drawRect:(CGRect)rect {
    self.clipsToBounds = YES;
    self.layer.cornerRadius = self.frame.size.height / 2;
}
*/

@end
